import {
    createRouter,
    createWebHashHistory
} from 'vue-router'

import Home from '../views/HomeView.vue'
import Movie from '../views/MovieView.vue'

const routes = [{
        path: '/',
        name: 'home',
        component: Home, // 首页
        redirect: '/movie',
        children: [{
                path: 'movie',
                name: 'movie',
                component: Movie // 电影列表
            },
            {
                path: 'video',
                name: 'video',
                component: () => import('../views/VideoView.vue')
            },
            {
                path: 'smallvideo',
                name: 'smallvideo',
                component: () => import('../views/SmallVideo.vue')
            },
            {
                path: 'user',
                name: 'user',
                component: () => import('../views/UserView.vue')
            }
        ]
    },
    {
        path: '/detail',
        name: 'detail',
        component: () => import('../views/DetailView.vue')
    },
    {
        path: '/search',
        name: 'search',
        component: () => import('../views/SearchView.vue')
    },
    {
        path: '/cinemadetail',
        name: 'cinemadetail',
        component: () => import('../views/CinemaDetailView.vue')
    },
    {
        path: '/video/:id',
        name: 'VideoFeed',
        component: () => import('../views/VideoFeed.vue')
    },
    {
        path: '/city-list',
        name: 'CityList',
        component: () => import('../views/CityList.vue')
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router